<?php 
require_once '../include/includefiles.php';
require_once '../include/userislogin.php';
?>
<?php 
  if($_GET['act']=='col_del'){
  	$id = $_GET['id'];
  	$query = "select count(*) n from `column` where pid =".$id;
  	$result = mysql_query($query) or die("查询子栏目失败");
  	$row = mysql_fetch_array($result);
  	$n = $row['n'];
  	if($n>0){
  		alertmsg("请先删除子栏目");
  	}
  	$query = "delete from `column` where id = ".$id;
  	$result = mysql_query($query) or die("删除栏目失败");
  	if($result){
  		alertmsg("删除栏目成功");
  	}
  }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>栏目管理</title>
<link href="images/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="images/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
  $(function(){
     $('.del').click(function(){
    	 var r=confirm("确认要删除吗?");
		 if(r){
		   return true;
		 }else{
			 return false;
	     }
     });
   
  });
</script>
</head>

<body>
<h3 class="title">栏目管理</h3>
<div class="columns">
<a href='col_add.php?rootid=-1'>添加根栏目</a>
<?php column_tree(-1);?>


</div>
</body>
</html>
